package com.erp.erp_servers.CustomerAutoPool.imp;

import com.erp.erp_dao.CustomerAutoPool.ICustomerAutoPoolDAO;
import com.erp.erp_entitys.CustomerAutoPool.CustomerAutoPool;
import com.erp.erp_entitys.CustomerAutoPool.CustomerAutoPoolExample;
import com.erp.erp_servers.CustomerAutoPool.ICustomerAutoPoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ImpCustomerAutoPoolService implements ICustomerAutoPoolService {
    @Autowired
    ICustomerAutoPoolDAO customerAutoPoolDAO;
    @Override
    public int deleteByExample(CustomerAutoPoolExample example) {
        return customerAutoPoolDAO.deleteByExample(example);
    }

    @Override
    public int insert(CustomerAutoPool record) {
        return customerAutoPoolDAO.insert(record);
    }

    @Override
    public int insertSelective(CustomerAutoPool record) {
        CustomerAutoPoolExample example=new CustomerAutoPoolExample();
        CustomerAutoPoolExample.Criteria criteria = example.createCriteria();
        criteria.andTypeEqualTo(record.getType());
        criteria.andPoolTypeEqualTo(record.getPoolType());
        customerAutoPoolDAO.deleteByExample(example);
        return customerAutoPoolDAO.insertSelective(record);
    }

    @Override
    public List<CustomerAutoPool> selectByExample(CustomerAutoPoolExample example) {
        return customerAutoPoolDAO.selectByExample(example);
    }
}
